<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
	<div region="center" style="padding: 0px; border: 0px">
		<t:datagrid name="wxCodeUploadMgrList" checkbox="true"
			fitColumns="false" title="代码管理"
			actionUrl="wxCodeUploadMgrController.do?datagrid" idField="id"
			fit="true" queryMode="group">
			<t:dgCol title="主键" field="id" hidden="true" queryMode="single"
				width="120"></t:dgCol>
			<t:dgCol title="创建人名称" field="createName" hidden="true"
				queryMode="single" width="120"></t:dgCol>
			<t:dgCol title="创建人登录名称" field="createBy" hidden="true"
				queryMode="single" width="120"></t:dgCol>
			<t:dgCol title="创建日期" field="createDate" formatter="yyyy-MM-dd"
				hidden="true" queryMode="single" width="120"></t:dgCol>
			<t:dgCol title="更新人名称" field="updateName" hidden="true"
				queryMode="single" width="120"></t:dgCol>
			<t:dgCol title="更新人登录名称" field="updateBy" hidden="true"
				queryMode="single" width="120"></t:dgCol>
			<t:dgCol title="更新日期" field="updateDate" formatter="yyyy-MM-dd"
				hidden="true" queryMode="single" width="120"></t:dgCol>
			<t:dgCol title="所属部门" field="sysOrgCode" hidden="true"
				queryMode="single" width="120"></t:dgCol>
			<t:dgCol title="所属公司" field="sysCompanyCode" hidden="true"
				queryMode="single" width="120"></t:dgCol>

			<t:dgCol title="代码版本号" field="userVersion" queryMode="single"
				width="120"></t:dgCol>
			<t:dgCol title="代码描述" field="userDesc" hidden="false"
				queryMode="single" width="120"></t:dgCol>
			<t:dgCol title="状态" field="status" queryMode="single"
				dictionary="auditState" width="120"></t:dgCol>
			<t:dgCol title="上传审核id" field="auditId" hidden="true"
				queryMode="single" width="120"></t:dgCol>

			<t:dgCol title="小程序id" field="appId" hidden="true" queryMode="single"
				width="120"></t:dgCol>
			<t:dgCol title="第三方平台Appid" field="componentAppId" hidden="true"
				queryMode="single" width="120"></t:dgCol>
			<t:dgCol title="模板id" field="templateId" queryMode="single"
				width="120"></t:dgCol>
			<t:dgCol title="审核日期" field="auditDate" queryMode="single"
				width="120"></t:dgCol>
			<t:dgCol title="审核失败理由" field="rejectReason" queryMode="single"
				width="120"></t:dgCol>
			<t:dgCol title="小程序配置参数" field="extJson" hidden="true"
				queryMode="single" width="120"></t:dgCol>

			<t:dgCol title="操作" field="opt" width="150"></t:dgCol>
			<t:dgDelOpt title="删除"
				url="wxCodeUploadMgrController.do?doDel&id={id}" />
			<t:dgFunOpt funname="confirmSubmitAudit(id)" title="提交审核"></t:dgFunOpt>
			<t:dgFunOpt funname="confirmPublish(id)" title="发布"></t:dgFunOpt>

			<t:dgToolBar title="录入" icon="icon-add"
				url="wxCodeUploadMgrController.do?goAdd" funname="add"></t:dgToolBar>
			<%--   <t:dgToolBar title="编辑" icon="icon-edit" url="wxCodeUploadMgrController.do?goUpdate" funname="update"></t:dgToolBar>
   <t:dgToolBar title="批量删除"  icon="icon-remove" url="wxCodeUploadMgrController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>
    --%>
			<t:dgToolBar title="查看" icon="icon-search"
				url="wxCodeUploadMgrController.do?goUpdate" funname="detail"></t:dgToolBar>
			<t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>
			<t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
			<t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar>
		</t:datagrid>
	</div>
	<div id="dialog" title="提示框"></div>
	<script
		src="webpage/com/gomore/wechat/component/codemgr/wxCodeUploadMgrList.js"></script>
	<script type="text/javascript">
 $(document).ready(function(){
 		//给时间控件加上样式
 			$("#wxCodeUploadMgrListtb").find("input[name='createDate']").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 			$("#wxCodeUploadMgrListtb").find("input[name='updateDate']").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 });
 
   
 
//导入
function ImportXls() {
	openuploadwin('Excel导入', 'wxCodeUploadMgrController.do?upload', "wxCodeUploadMgrList");
}

//导出
function ExportXls() {
	JeecgExcelExport("wxCodeUploadMgrController.do?exportXls","wxCodeUploadMgrList");
}

//模板下载
function ExportXlsByT() {
	JeecgExcelExport("wxCodeUploadMgrController.do?exportXlsByT","wxCodeUploadMgrList");
}

//提交审核
function confirmSubmitAudit(id){
	$.dialog({
	      resizable: false,
	      content : '确认提交审核?',
		  zIndex : 3100,
		  title : '提示',
		  lock : true,
		  width : '400px',
		  height : '120px',
		  opacity : 0.4,
	      modal: true,
	      button: [
	    	{
	    		name : '确认',
	 	 	    callback : function() {
	 	 	    	submitAudit(id);
	 	 	      },
	 	 	      focus : true
	    	  },
	       {
	    	   name : '取消',
	 	 	   callback : function() {
	 	 	        
	 	 	},
	      }]
	 }).zindex();
}

function submitAudit(id){
	$.post("wxCodeUploadMgrController.do?submitAudit",{id:id}, function(data) {
 		var d = $.parseJSON(data);
 		if (d.success) {
 			$.messager.show({
 				title : '提示',
 				msg : d.msg,
 				showType : 'show'
 			});
 		}
 	});
}

function confirmPublish(id){
	$.dialog({
	      resizable: false,
	      content : '确认发布?',
		  zIndex : 3100,
		  title : '提示',
		  lock : true,
		  width : '400px',
		  height : '120px',
		  opacity : 0.4,
	      modal: true,
	      button: [
	    	{
	    		name : '确认',
	 	 	    callback : function() {
	 	 	    	 publish(id);
	 	 	      },
	 	 	      focus : true
	    	  },
	       {
	    	   name : '取消',
	 	 	   callback : function() {
	 	 	        
	 	 	},
	      }]
	 }).zindex();
}

//发布
function publish(id){
	 $.post("wxCodeUploadMgrController.do?publish",{id:id}, function(data) {
 		var d = $.parseJSON(data);
 		if (d.success) {
 			$.messager.show({
 				title : '提示',
 				msg : d.msg,
 				showType : 'show'
 			});
 		}
 	});

}

 </script>